package com.jnetx.javax.sip.message;

import com.jnetx.javax.sip.Messages;
import junit.framework.TestCase;

import javax.sip.message.Message;

/**
 * Created by IntelliJ IDEA.
 * User: deps
 * Date: 01.04.11
 * Time: 19:56
 * To change this template use File | Settings | File Templates.
 */
public class SIPMessageParserTest extends TestCase {
    public SIPMessageParserTest(String name) {
        super(name);
    }

    public void test() throws Exception {
        SIPMessage message = SIPMessageParser.parse(Messages.INVITE1.getBytes());
        assertNotNull(message);
        assertTrue(message instanceof SIPRequest);
        message = SIPMessageParser.parse(Messages.RESPONSE1.getBytes());
        assertNotNull(message);
        assertTrue(message instanceof SIPResponse);
        SIPResponse response = (SIPResponse) message;
        assertEquals(200, response.getStatusCode());
        assertEquals("SIP/2.0", response.getSIPVersion());
        assertEquals("OK", response.getReasonPhrase());
    }
}
